using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;

namespace ElevatorSpeeches.Framework
{
    /// <summary>
    /// A  provable, citable fact.
    /// </summary>
    [ActiveRecord]
    public class Fact : EntityBase<Fact>
    {
        /// <summary>
        /// Gets or sets the body of the fact.
        /// </summary>
        /// <value>The body.</value>
        [Property]
        [ValidateNotEmpty]
        [ValidateLength(10, 7000)]
        public string Body { get; set; }

        /// <summary>
        /// Gets or sets the fact's reference.
        /// </summary>
        /// <remarks>A Reference is a URL citing the original source, hence the minimum length of 8 characters ("http://" is already 7).</remarks>
        /// <value>The reference.</value>
        [Property]
        [ValidateNotEmpty]
        [ValidateLength(8, 256)]
        public string Reference { get; set; }

        /// <summary>
        /// Gets or sets the type of Fact.
        /// </summary>
        /// <value>The type.</value>
        [Property]
        [ValidateNotEmpty]
        public FactType Type { get; set;}

        /// <summary>
        /// Gets or sets the user who created the fact.
        /// </summary>
        /// <value>The user.</value>
        [BelongsTo("UserID")]
        public User User {get; set; }
    }
}
